Skip to content

feat(dashboard): render captured tool_output in session detail#8

Merged
yyiilluu merged 1 commit intomainfrom
feat/dashboard-tool-output-render
Apr 26, 2026
Merged

feat(dashboard): render captured tool_output in session detail#8
yyiilluu merged 1 commit intomainfrom
feat/dashboard-tool-output-render

Conversation

@yyiilluu
Copy link
Copy Markdown
Contributor

@yyiilluu yyiilluu commented Apr 26, 2026

Summary

  • Surfaces the per-tool tool_output field that the publisher started capturing in feat: detached dashboard build + capture tool output for reflexio #6 — the dashboard previously only rendered tool input.
  • Mirrors the publisher's 256-char truncation cap (_TOOL_DATA_FIELD_MAX_LEN in plugin/src/claude_smart/state.py) so the UI shows exactly the bytes the extractor sees.

Changes

plugin/dashboard/lib/types.ts

  • ToolUsed.tool_data extended to { input?: Record<string, unknown>; output?: string }.

plugin/dashboard/lib/session-reader.ts

  • RawRecord gains tool_output?: string.
  • New TOOL_DATA_FIELD_MAX_LEN = 256 constant with a comment pointing back to state.py (single source of truth lives in Python; the cross-language duplicate is documented).
  • New generic truncateToolField<T>(value: T): T helper — truncates only when value is a string longer than the cap, passes everything else through untouched.
  • foldTurns now folds tool_output into tool_data.output (when non-empty) and runs each top-level tool_input value through truncateToolField. The "absent when empty" contract from state.py:unpublished_slice is preserved.

plugin/dashboard/app/sessions/[sessionId]/page.tsx

  • Reads t.tool_data?.output alongside t.tool_data?.input.
  • Tool badge becomes expandable when either input or output is present (previously only input gated expansion).
  • Inside <details>, renders labeled input and output sections in a small stack — each a <pre> block with the existing styling.

Test Plan

  • npx tsc --noEmit → clean (EXIT=0).
  • npx biome check lib/session-reader.ts lib/types.ts 'app/sessions/[sessionId]/page.tsx' → clean (EXIT=0).
  • Manual: open the dashboard on a session with recent Bash/Read tool calls — the tool badge expands to show both input (existing) and the new output block, truncated at 256 chars; tools with empty tool_output continue to render input-only with no empty output section.

Summary by CodeRabbit

  • New Features
    • Tool outputs are now captured and displayed in session transcripts alongside tool inputs
    • Tool data is presented in a structured format with clearly labeled input and output sections
    • Long outputs are automatically truncated to maintain readability

Surfaces the per-tool `tool_output` field that the publisher started
capturing in #6. The session detail page now expands the tool badge
when input or output is present and renders labeled `input` / `output`
panes, mirroring `state.py:unpublished_slice`'s 256-char truncation so
the dashboard shows the same bytes the extractor sees.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ff7a86b9-cdbe-430c-ba7e-d84840c2f722

📥 Commits

Reviewing files that changed from the base of the PR and between 007dda2 and 9d1fab7.

📒 Files selected for processing (3)
  • plugin/dashboard/app/sessions/[sessionId]/page.tsx
  • plugin/dashboard/lib/session-reader.ts
  • plugin/dashboard/lib/types.ts

📝 Walkthrough

Walkthrough

Tool output support is extended across the dashboard. The session reader now extracts tool_output from JSONL records and populates tool_data.output with 256-character truncation. The ToolUsed type includes an optional output field, and the session page UI displays both input and output in structured form.

Changes

Cohort / File(s) Summary
Tool Output Support
plugin/dashboard/lib/types.ts, plugin/dashboard/lib/session-reader.ts, plugin/dashboard/app/sessions/[sessionId]/page.tsx
Extended tool data to capture, truncate, and display both input and output. Session reader extracts tool_output from JSONL records with 256-character truncation limit. UI components updated to conditionally render labeled input/output blocks based on field presence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Through transcripts I hop, now with output in sight,
Both input and answers shine brilliant and bright,
Truncated with care at two-five-six's delight,
Tool data flows cleanly, a structure so tight! 🛠️✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: adding tool output rendering to the dashboard session detail view, which is the primary objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dashboard-tool-output-render

Comment @coderabbitai help to get the list of available commands and usage tips.

@yyiilluu yyiilluu merged commit 5527674 into main Apr 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant